<div class="col-lg-8">
	<div class="panel panel-default">
		<div class="panel-body" style = "background: #CEE3F6">
		
		<div class="form-group col-xs-6"  style="margin-left:50%">
			</br><label style="color: rgb(224, 73, 1);"><span class="glyphicon glyphicon-asterisk" id="icon"/>&nbsp;Campos obligatorios</label>
		</div>
		
			<div class="col-lg-12"><h2>Nuevo<b id="resaltador"> Centro de Investigaci&oacute;n</b></h2><br/><br/></div>
			<div class="col-xs-12">
				<form id ="myForm" role="form" action="insertar_registro.php" onsubmit="return validar();" method="post">
					<div class="form-group col-xs-8">
						<label><span class="glyphicon glyphicon-asterisk" id="icon"/>Nombre&nbsp;</label>
						<input type="text" class="form-control" name="nombre"  placeholder="Centro de Investigacion de Ejemplos"required>
					</div>
					<div id="id" class="form-group col-xs-4">
						<label><span class="glyphicon glyphicon-asterisk" id="icon"/>Siglas&nbsp;</label>
						<input type="text" class="form-control" name="id" placeholder="CIE" required>
					</div>
					<div class="col-xs-12"></br></div>
					<div class="col-xs-4"></div>
					<div class="col-xs-4">
						<button type="submit" id="agregar" class="btn btn-primary form-control">Agregar</button>
					</div>
					<div class="col-xs-4"></div>
					<div class="col-xs-12"></br></div>
					<input type="hidden" name="tabla" value="centro">
				</form>
			</div>
		</div>
	</div>
</div>

<script>
$('[name=id]').keyup(function (e) {
	var code = $(this).val(); 
	if(/^[A-Z]+$/.test(code)) $("#id").removeClass("has-error");
	else $("#id").addClass("has-error");

});

function validar()
{
	var code = $('[name=id]').val();
	if(!/^[A-Z]+$/.test(code)) alert("Uno o más campos inválidos!\nVerífiquelos antes de continuar.");
	return (/^[A-Z]+$/.test(code));
}

$("#agregar").click(function(){return confirm("¿Está seguro que desea continuar?")});
</script>